<template>
    <div class="s-body">
      
    </div>
</template>

<style lang="less" scoped>
.s-body {
  width: 100%;
  height: 100vh;
  position: relative;
}
</style>
<script>
export default {
  data() {
    return {};
  },
  mounted: function() {
    this.onLoad();
  },
  methods: {
    onLoad() {
      this._auth();
    },
    _auth() {
      /*渲染页面回跳转判断*/
      let that = this;
      if (that.isWeiXin()) {
        //是否有缓存
        //设置测试openid
        //that.$storage.set('openid','123')
        //删除测试数据
        if(that.$storage.get('openid')==='123'){
          that.$storage.remove('openid','123')
        }
        // if(that.$storage.get('openid')){
        //   that.$router.push({
        //     path: "/Index"
        //   })
        // }else{
          //跳转获取code
          let url = encodeURIComponent(
            "http://pay.1207soft.com/silver/#/CommAuth" 
          );
          location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf0a6c4b02fcd19e8&redirect_uri=${url}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`;
        //}
      } else {
        this.open("暂不支持非微信扫码！");
      }
    },
    isWeiXin() {
      var ua = window.navigator.userAgent.toLowerCase();
      if (ua.match(/MicroMessenger/i) == "micromessenger") {
        return true;
      } else {
        return false;
      }
    },
    isAlipay() {
      var ua = window.navigator.userAgent.toLowerCase();
      if (ua.match(/AlipayClient/i) == "alipayclient") {
        return true;
      } else {
        return false;
      }
    },
    //提示
    open(str) {
      this.$totast(str);
    }
  }
};
</script>
